<?php

/* 
 *------------------------------------------------------------------------------
 * Project Name  : e-Synergy Library System
 *         Code  : ESN-LBS
 *
 * Created By    : Junlapong
 *         Date  : 2010/01/20
 * 
 * $Id$
 *------------------------------------------------------------------------------
 *    copyright: e-Synergy Co., Ltd.
 *==============================================================================
 */

?>

<html>
<head>
<title><?= lang('login_title') ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="<?= site_url('images/favicon.ico') ?>" />

<!-- START COMMON JAVASCRIPT/CSS -->
<?= esn_common_script() ?>
<!-- END COMMON JAVASCRIPT/CSS -->

<!-- START USER JAVASCRIPT -->
<script type="text/javascript">

	function validate_submit()
	{
		var username = jQuery.trim($("#txtUsername").val());
		var password = jQuery.trim($("#txtPassword").val());
	
		if (username == "")
		{
			$("#error_msg").html("<?= lang('login_username_require') ?>");
		}
		else if (password == "")
		{
			$("#error_msg").html("<?= lang('login_password_require') ?>");
		}
		else
		{
			$("#frmLogin").submit();
		}
	}

	$(document).ready(function() {

		$("#txtUsername").attr('autocomplete', 'off');
		$("#txtUsername").focus();

		$("#btnLogin").click(function() {
			validate_submit();
		});

		$(".box").keypress(function(e) {
			if(e.which == 13)
			{
				validate_submit()
			}
		});
	});

</script>
<!-- START USER JAVASCRIPT -->

<!-- END USER CSS -->
<style type="text/css">

	#error_msg {
		color: red;
	}

</style>
<!-- END USER CSS -->

</head>
<body>
<div id='div_login'>
<form id="frmLogin" method="post"	action="<?= site_url('login/authenticate') ?>">
<table width="100%" height="100%" border="0">
	<tr>
		<td align="center" valign="middle">
		<table id="login" width="300" border="0">
			<tr>
				<td colspan="2" height="38"></td>
			</tr>
			<tr>
				<td width="92" class="label"><?= lang('login_username')?></td>
				<td align="left">
					<input type="text" id="txtUsername" name="username"
					value="<?= $input['username'] = 'user' ?>"
					class="box box_search normal_button"  />
				</td>
			</tr>
			<tr>
				<td class="label"><?= lang('login_password')?></td>
				<td align="left">
					<input type="password" id="txtPassword" name="password" value="user"
					class="box box_search normal_button" />
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
				<table class="fontNormal" cellspacing="0" cellpadding="0" border="0">
					<tr>
						<td class="label">
							<input type="checkbox" name="remember_pass" id="remember_pass" <?= $input['remember_pass'] ?>" />
						</td>
						<td>
							<label for="remember_pass"><?= lang('login_remember')?></label>
						</td>
					</tr>
				</table>
				</td>
			</tr>
			<tr id="page_button">
				<td></td>
				<td>
					<input type="button" id="btnLogin" class="button button_login enable" value="<?= lang('login_button') ?>" /> 
				</td>
			</tr>
			<tr>
				<td></td>
				<td id="error_msg"><?= $error_message ?></td>
			</tr>
			<tr>
				<td colspan="2" height="5"></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
</div>
</body>

</html>